{% extends "skia_telemetry_base.html" %}

{% block content %}

<center>
  <br/><br/>

  <a id='chromium_try'><h2>Chromium Try Tasks</h2></a>
  <br/>

  {% if chromium_try_tasks %}
  <table border="1" cellpadding="5">
    <tr bgcolor="#CCCCFF">
      <td><b>User</b></td>
      <td><b>Description</b></td>
      <td><b>Benchmark Name</b></td>
      <td><b>Benchmark Argument</b></td>
      <td><b>Repeat Runs</b></td>
      <td><b>Variance Threshold</b></td>
      <td><b>Discard Outliers</b></td>
      <td><b>Pagesets Type</b></td>
      <td><b>Requested Time</b></td>
      <td><b>Completed Time</b></td>
      <td><b>Chromium Patch Link</b></td>
      <td><b>Blink Patch Link</b></td>
      <td><b>Skia Patch Link</b></td>
      <td><b>Build Log</b></td>
      <td><b>Telemetry nopatch Log</b></td>
      <td><b>Telemetry withpatch Log</b></td>
      <td><b>HTML comparision</b></td>
    </tr>
    {% for task in chromium_try_tasks %}
    <tr {% if not task.completed_time %}bgcolor="#8FDF5F"{% endif %} >
      <td>{{ task.username }}</td>
      <td>{{ task.description }}</td>
      <td>{{ task.benchmark_name }}</td>
      <td>{{ task.benchmark_arguments }}</td>
      <td>
        {% if task.num_repeated_runs %}
          {{ task.num_repeated_runs }}
        {% else %}
          1
        {% endif %}
      </td>
      <td>{{ task.variance_threshold }}</td>
      <td>{{ task.discard_outliers }}</td>
      <td>
        {% if task.pageset_type %}
          {{ task.pageset_type }}
        {% else %}
          10k
        {% endif %}
      </td>
      <td>{{ task.requested_time }}</td>
      <td>
        {% if task.completed_time %}
          {{ task.completed_time }}
        {% else %}
          {% include "col_status.html" %}
        {% endif %}
      </td>
      <td align="center">                                                       
        {% if task.chromium_patch_link %}                                                
          <a href='{{ task.chromium_patch_link }}' target='_blank'>patch</a>             
        {% else %}                                                              
          {% include "col_status.html" %}                                       
        {% endif %}                                                             
      </td>                                                                     
      <td align="center">                                                       
        {% if task.blink_patch_link %}                                                
          <a href='{{ task.blink_patch_link }}' target='_blank'>patch</a>             
        {% else %}                                                              
          {% include "col_status.html" %}                                       
        {% endif %}                                                             
      </td>                                                                     
      <td align="center">                                                       
        {% if task.skia_patch_link %}                                                
          <a href='{{ task.skia_patch_link }}' target='_blank'>patch</a>             
        {% else %}                                                              
          {% include "col_status.html" %}                                       
        {% endif %}                                                             
      </td>                                                                     
      <td align="center">                                                       
        {% if task.build_log_link %}                                            
          <a href='{{ task.build_log_link }}' target='_blank'>build_log</a>     
        {% else %}                                                              
          {% include "col_status.html" %}                                       
        {% endif %}                                                             
      </td>                                                                     
      <td align="center">                                                       
        {% if task.telemetry_nopatch_log_link %}                                
          <a href='{{ task.telemetry_nopatch_log_link }}' target='_blank'>nopatch_log</a>
        {% else %}                                                              
          {% include "col_status.html" %}                                       
        {% endif %}                                                             
      </td>                                                                     
      <td align="center">                                                       
        {% if task.telemetry_withpatch_log_link %}                              
          <a href='{{ task.telemetry_withpatch_log_link }}' target='_blank'>withpatch_log</a>
        {% else %}                                                              
          {% include "col_status.html" %}                                       
        {% endif %}                                                             
      </td>                                                                     
      <td align="center">                                                       
        {% if task.html_output_link %}                                          
          <a href='{{ task.html_output_link }}' target='_blank'>output</a>      
        {% else %}                                                              
          {% include "col_status.html" %}                                       
        {% endif %}                                                             
      </td>
    </tr>
    {% endfor %}
  </table>
    {% if chromium_try_tasks_prev_offset == 0 or chromium_try_tasks_prev_offset %}
      <a href='/skia-telemetry/all_tasks?chromium_try_tasks_offset={{ chromium_try_tasks_prev_offset }}#chromium_try_tasks'>Previous</a>
    {% endif %}
    {% if chromium_try_tasks_next_offset %}
      <a href='/skia-telemetry/all_tasks?chromium_try_tasks_offset={{ chromium_try_tasks_next_offset }}#chromium_try_tasks'>Next</a>
    {% endif %}
  {% else %}
    No Previous runs yet.
  {% endif %}

  <br/><br/>

  <a id='skia_try'><h2>Skia Try Tasks</h2></a>
  <br/>

  {% if skia_try_tasks %}
    {% include "skia_try_tasks_table.html" %}

    {% if skia_try_tasks_prev_offset == 0 or skia_try_tasks_prev_offset %}
      <a href='/skia-telemetry/all_tasks?skia_try_tasks_offset={{ skia_try_tasks_prev_offset }}#skia_try'>Previous</a>
    {% endif %}
    {% if skia_try_tasks_next_offset %}
      <a href='/skia-telemetry/all_tasks?skia_try_tasks_offset={{ skia_try_tasks_next_offset }}#skia_try'>Next</a>
    {% endif %}
  {% else %}
    No Previous runs yet.
  {% endif %}

  <br/><br/>

  <a id='telemetry'><h2>All Telemetry benchmark runs history</h2></a>
  <br/>

  {% if telemetry_tasks %}
  <table border="1" cellpadding="5">
    <tr bgcolor="#CCCCFF">
      <td><b>User</b></td>
      <td><b>Description</b></td>
      <td><b>Benchmark Name</b></td>
      <td><b>Benchmark Arguments</b></td>
      <td><b>Pagesets Type</b></td>
      <td><b>Chromium Build</b></td>
      <td><b>Requested Time</b></td>
      <td><b>Completed Time</b></td>
      <td><b>Whitelist File</b></td>
      <td><b>Output Link</b></td>
    </tr>
    {% for task in telemetry_tasks %}
    <tr {% if not task.completed_time %}bgcolor="#8FDF5F"{% endif %} >
      <td>{{ task.username }}</td>
      <td>{{ task.description }}</td>
      <td>{{ task.benchmark_name }}</td>
      <td>{{ task.benchmark_arguments }}</td>
      <td>{{ task.pagesets_type }}</td>
      <td>
        {% if task.chromium_rev and task.skia_rev %}
          <a href='https://chromium.googlesource.com/chromium/src/+/{{ task.chromium_rev }}'>{{ task.chromium_rev|slice:":7" }}</a>-<a href='https://skia.googlesource.com/skia/+/{{ task.skia_rev }}'>{{ task.skia_rev|slice:":7" }}</a>
        {% else %}
          N/A
        {% endif %}
      </td>

      <td>{{ task.requested_time }}</td>
      <td>
        {% if task.completed_time %}
          {{ task.completed_time }}
        {% else %}
          {% ifequal task.key.id_or_name oldest_pending_task_key %}
            In Progress
          {% else %}
            Waiting in Queue
          {% endifequal %}
        {% endif %}
      </td>
      <td align="center">
        {% if task.whitelist_file %}
          <form action="/skia-telemetry/skia_telemetry_info_page" name="display_whitelist_file" method="post">
            <input type='hidden' name='whitelist_key' value='{{ task.key.id_or_name }}'>
            <input type='submit' value='Whitelist File'>
          </form>
        {% else %}
          None
        {% endif %}
      </td>
      <td align="center">
        {% if task.output_link %}
          <a href='{{ task.output_link }}' target='_blank'>output</a>
        {% else %}
          {% ifequal task.key.id_or_name oldest_pending_task_key %}
            In Progress
          {% else %}
            Waiting in Queue
          {% endifequal %}
        {% endif %}
      </td>
    </tr>
    {% endfor %}
  </table>
    {% if telemetry_tasks_prev_offset == 0 or telemetry_tasks_prev_offset %}
      <a href='/skia-telemetry/all_tasks?telemetry_tasks_offset={{ telemetry_tasks_prev_offset }}#telemetry'>Previous</a>
    {% endif %}
    {% if telemetry_tasks_next_offset %}
      <a href='/skia-telemetry/all_tasks?telemetry_tasks_offset={{ telemetry_tasks_next_offset }}#telemetry'>Next</a>
    {% endif %}

  {% else %}
    No Previous runs yet.
  {% endif %}

  <br/><br/>

  <a id='lua'><h2>All Lua script runs history</h2></a>
  <br/>

  {% if lua_tasks %}
  <table border="1" cellpadding="5">
    <tr bgcolor="#CCCCFF">
      <td><b>User</b></td>
      <td><b>Description</b></td>
      <td><b>Pagesets Type</b></td>
      <td><b>Chromium Build</b></td>
      <td><b>Requested Time</b></td>
      <td><b>Completed Time</b></td>
      <td><b>Lua Script Link</b></td>
      <td><b>Lua Aggregator Link</b></td>
      <td><b>Lua Output Link</b></td>
    </tr>
    {% for task in lua_tasks %}
    <tr {% if not task.completed_time %}bgcolor="#8FDF5F"{% endif %} >
      <td>{{ task.username }}</td>
      <td>{{ task.description }}</td>
      <td>{{ task.pagesets_type }}</td>
      <td>
        {% if task.chromium_rev and task.skia_rev %}
          <a href='https://chromium.googlesource.com/chromium/src/+/{{ task.chromium_rev }}'>{{ task.chromium_rev|slice:":7" }}</a>-<a href='https://skia.googlesource.com/skia/+/{{ task.skia_rev }}'>{{ task.skia_rev|slice:":7" }}</a>
        {% else %}
          N/A
        {% endif %}
      </td>
      <td>{{ task.requested_time }}</td>
      <td>
        {% if task.completed_time %}
          {{ task.completed_time }}
        {% else %}
          {% ifequal task.key.id_or_name oldest_pending_task_key %}
            In Progress
          {% else %}
            Waiting in Queue
          {% endifequal %}
        {% endif %}
      </td>
      <td align="center">
        {% if task.lua_script_link %}
          <a href='{{ task.lua_script_link }}' target='_blank'>script</a>
        {% else %}
          {% ifequal task.key.id_or_name oldest_pending_task_key %}
            In Progress
          {% else %}
            Waiting in Queue
          {% endifequal %}
        {% endif %}
      </td>
      <td align="center">
        {% if not task.lua_aggregator %}
          N/A
        {% else %}
          {% if task.lua_aggregator_link %}
            <a href='{{ task.lua_aggregator_link }}' target='_blank'>script</a>
          {% else %}
            {% ifequal task.key.id_or_name oldest_pending_task_key %}
              In Progress
            {% else %}
              Waiting in Queue
            {% endifequal %}
          {% endif %}
        {% endif %}
      </td>
      <td align="center">
        {% if task.lua_output_link %}
          <a href='{{ task.lua_output_link }}' target='_blank'>output</a>
        {% else %}
          {% ifequal task.key.id_or_name oldest_pending_task_key %}
            In Progress
          {% else %}
            Waiting in Queue
          {% endifequal %}
        {% endif %}
      </td>
    </tr>
    {% endfor %}
  </table>
    {% if lua_tasks_prev_offset == 0 or lua_tasks_prev_offset %}
      <a href='/skia-telemetry/all_tasks?lua_tasks_offset={{ lua_tasks_prev_offset }}#lua'>Previous</a>
    {% endif %}
    {% if lua_tasks_next_offset %}
      <a href='/skia-telemetry/all_tasks?lua_tasks_offset={{ lua_tasks_next_offset }}#lua'>Next</a>
    {% endif %}
  {% else %}
    No Previous runs yet.
  {% endif %}

  <br/><br/>

  <a id='admin'><h2>All Admin Tasks</h2></a>
  <br/>

  {% if admin_tasks %}
  <table border="1" cellpadding="5">
    <tr bgcolor="#CCCCFF">
      <td><b>User</b></td>
      <td><b>Task</b></td>
      <td><b>Pagesets Type</b></td>
      <td><b>Chromium Build</b></td>
      <td><b>Requested Time</b></td>
      <td><b>Completed Time</b></td>
    </tr>
    {% for task in admin_tasks %}
    <tr {% if not task.completed_time %}bgcolor="#8FDF5F"{% endif %} >
      <td>{{ task.username }}</td>
      <td>{{ task.task_name }}</td>
      <td>{{ task.pagesets_type }}</td>
      <td>
        {% if task.chromium_rev and task.skia_rev %}
          <a href='https://chromium.googlesource.com/chromium/src/+/{{ task.chromium_rev }}'>{{ task.chromium_rev|slice:":7" }}</a>-<a href='https://skia.googlesource.com/skia/+/{{ task.skia_rev }}'>{{ task.skia_rev|slice:":7" }}</a>
        {% else %}
          N/A
        {% endif %}
      </td>

      <td>{{ task.requested_time }}</td>
      <td>
        {% if task.completed_time %}
          {{ task.completed_time }}
        {% else %}
          {% ifequal task.key.id_or_name oldest_pending_task_key %}
            In Progress
          {% else %}
            Waiting in Queue
          {% endifequal %}
        {% endif %}
      </td>
    </tr>
    {% endfor %}
  </table>
    {% if admin_tasks_prev_offset == 0 or admin_tasks_prev_offset %}
      <a href='/skia-telemetry/all_tasks?admin_tasks_offset={{ admin_tasks_prev_offset }}#admin'>Previous</a>
    {% endif %}
    {% if admin_tasks_next_offset %}
      <a href='/skia-telemetry/all_tasks?admin_tasks_offset={{ admin_tasks_next_offset }}#admin'>Next</a>
    {% endif %}
  {% else %}
    No Previous runs yet.
  {% endif %}

</center>

{% endblock %}
